Evaluate JSON list in event rules

Hello,

We currently use event rules to determine some conditions based on the JSON payload a monitoring tool sends to PagerDuty.

We’d like to extend those conditions to set a higher severity based on the number of items a list within that JSON payload contains. For example, the length of the rankedImpacts list below:

{
  "payload": {
    "problem_id": "P-2105138",
    "status": "OPEN",
    "startTime": 1620217200000,
    "rankedImpacts": [
      {
        "severityLevel": "PERFORMANCE",
        "impactLevel": "SERVICE",
        "eventType": "SERVICE_RESPONSE_TIME_DEGRADED",
        "entityId": "SERVICE-50DEBE6435845660"
      },
      {
        "severityLevel": "PERFORMANCE",
        "impactLevel": "APPLICATION",
        "eventType": "USER_ACTION_DURATION_DEGRADATION",
        "entityId": "APPLICATION-7513BD1C9B571102"
      },
      <list goes on>
    ]
  }
}

I understand this is easily achievable using tools such as JSONPath expressions, but I am not aware if PagerDuty supports them.

(this was originally a support request, moved to feature request)
-Anyone knows how to achieve this entirely within PagerDuty?-

Please consider adding this as a feature in the event rules processing.

Thank you

Hi Gustavo,

This isn’t a function that PagerDuty supports. Severity can be based on a string match, but not based on the number of items in an array.

If you have any further questions on this, please don’t hesitate to reach out to our Support team directly at support@pagerduty.com.

Best,

Hi Tatiana,

Thanks for your reply. Moved this to a feature request then.

Will do - thanks Gustavo!

Kind regards,
John

In case you weren’t aware, this could be done using a Custom Event Transformer / Application Event Transformer associated with a service. You’d have full access to the payload and could write Javascript to process the payload as desired and set the severity based on that.

1 Like